package org.eztouch.common.result;

/**
 * ajax 返回对象工具
 */
public class ResultUtil {
	
	/**
     * ajax失败
     * @param msg 失败的消息
     * @return {Object}
     */
    public static Object renderError(String msg) {
        Result Result = new Result();
        Result.setMsg(msg);
        return Result;
    }

    /**
     * ajax成功
     * @return {Object}
     */
    public static Object renderSuccess() {
        Result Result = new Result();
        Result.setSuccess(true);
        return Result;
    }

    /**
     * ajax成功
     * @param msg 消息
     * @return {Object}
     */
    public static Object renderSuccess(String msg) {
        Result Result = new Result();
        Result.setSuccess(true);
        Result.setMsg(msg);
        return Result;
    }

    /**
     * ajax成功
     * @param obj 成功时的对象
     * @return {Object}
     */
    public static Object renderSuccess(Object obj) {
        Result Result = new Result();
        Result.setSuccess(true);
        Result.setObj(obj);
        return Result;
    }
    
    /**
     * ajax成功
     * @param obj 成功时的对象
     * @return {Object}
     */
    public static Object renderSuccess(String msg,Object obj) {
        Result Result = new Result();
        Result.setSuccess(true);
        Result.setObj(obj);
        Result.setMsg(msg);
        return Result;
    }
    
}
